home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 2.iso / dist / fw_libpng.idb / usr / freeware / include / pngconf.h.z / pngconf.h
C/C++ Source or Header  |  2000-06-09  |  28KB  |  959 lines

  1.  
  2. /* pngconf.h - machine configurable file for libpng
  3.  *
  4.  * libpng 1.0.6 - March 21, 2000
  5.  * For conditions of distribution and use, see copyright notice in png.h
  6.  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  7.  * Copyright (c) 1996, 1997 Andreas Dilger
  8.  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
  9.  */
  10.  
  11. /* Any machine specific code is near the front of this file, so if you
  12.  * are configuring libpng for a machine, you may want to read the section
  13.  * starting here down to where it starts to typedef png_color, png_text,
  14.  * and png_info.
  15.  */
  16.  
  17. #ifndef PNGCONF_H
  18. #define PNGCONF_H
  19.  
  20. /* This is the size of the compression buffer, and thus the size of
  21.  * an IDAT chunk.  Make this whatever size you feel is best for your
  22.  * machine.  One of these will be allocated per png_struct.  When this
  23.  * is full, it writes the data to the disk, and does some other
  24.  * calculations.  Making this an extremely small size will slow
  25.  * the library down, but you may want to experiment to determine
  26.  * where it becomes significant, if you are concerned with memory
  27.  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
  28.  * this describes the size of the buffer available to read the data in.
  29.  * Unless this gets smaller than the size of a row (compressed),
  30.  * it should not make much difference how big this is.
  31.  */
  32.  
  33. #ifndef PNG_ZBUF_SIZE
  34. #define PNG_ZBUF_SIZE 8192
  35. #endif
  36.  
  37. /* If you are running on a machine where you cannot allocate more
  38.  * than 64K of memory at once, uncomment this.  While libpng will not
  39.  * normally need that much memory in a chunk (unless you load up a very
  40.  * large file), zlib needs to know how big of a chunk it can use, and
  41.  * libpng thus makes sure to check any memory allocation to verify it
  42.  * will fit into memory.
  43. #define PNG_MAX_MALLOC_64K
  44.  */
  45. #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
  46. #define PNG_MAX_MALLOC_64K
  47. #endif
  48.  
  49. /* This protects us against compilers that run on a windowing system
  50.  * and thus don't have or would rather us not use the stdio types:
  51.  * stdin, stdout, and stderr.  The only one currently used is stderr
  52.  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
  53.  * prevent these from being compiled and used. #defining PNG_NO_STDIO
  54.  * will also prevent these, plus will prevent the entire set of stdio
  55.  * macros and functions (FILE *, printf, etc.) from being compiled and used,
  56.  * unless (PNG_DEBUG > 0) has been #defined.
  57.  *
  58.  * #define PNG_NO_CONSOLE_IO
  59.  * #define PNG_NO_STDIO
  60.  */
  61.  
  62. #  ifdef PNG_NO_STDIO
  63. #    ifndef PNG_NO_CONSOLE_IO
  64. #      define PNG_NO_CONSOLE_IO
  65. #    endif
  66. #    ifdef PNG_DEBUG
  67. #      if (PNG_DEBUG > 0)
  68. #        include <stdio.h>
  69. #      endif
  70. #    endif
  71. #  else
  72. #    include <stdio.h>
  73. #  endif
  74.  
  75. /* This macro protects us against machines that don't have function
  76.  * prototypes (ie K&R style headers).  If your compiler does not handle
  77.  * function prototypes, define this macro and use the included ansi2knr.
  78.  * I've always been able to use _NO_PROTO as the indicator, but you may
  79.  * need to drag the empty declaration out in front of here, or change the
  80.  * ifdef to suit your own needs.
  81.  */
  82. #ifndef PNGARG
  83.  
  84. #ifdef OF /* zlib prototype munger */
  85. #define PNGARG(arglist) OF(arglist)
  86. #else
  87.  
  88. #ifdef _NO_PROTO
  89. #define PNGARG(arglist) ()
  90. #else
  91. #define PNGARG(arglist) arglist
  92. #endif /* _NO_PROTO */
  93.  
  94. #endif /* OF */
  95.  
  96. #endif /* PNGARG */
  97.  
  98. /* Try to determine if we are compiling on a Mac.  Note that testing for
  99.  * just __MWERKS__ is not good enough, because the Codewarrior is now used
  100.  * on non-Mac platforms.
  101.  */
  102. #ifndef MACOS
  103. #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
  104.     defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
  105. #define MACOS
  106. #endif
  107. #endif
  108.  
  109. /* enough people need this for various reasons to include it here */
  110. #if !defined(MACOS) && !defined(RISCOS)
  111. #include <sys/types.h>
  112. #endif
  113.  
  114. #ifndef PNG_SETJMP_NOT_SUPPORTED
  115. #  define PNG_SETJMP_SUPPORTED
  116. #endif
  117.  
  118. #ifdef PNG_SETJMP_SUPPORTED
  119. /* This is an attempt to force a single setjmp behaviour on Linux.  If
  120.  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
  121.  */
  122. #  ifdef __linux__
  123. #    ifdef _BSD_SOURCE
  124. #      define _PNG_SAVE_BSD_SOURCE
  125. #      undef _BSD_SOURCE
  126. #    endif
  127. #    ifdef _SETJMP_H
  128.       __png.h__ already includes setjmp.h
  129.       __dont__ include it again
  130. #    endif
  131. #endif /* __linux__ */
  132.  
  133. /* include setjmp.h for error handling */
  134. #include <setjmp.h>
  135.  
  136. #  ifdef __linux__
  137. #    ifdef _PNG_SAVE_BSD_SOURCE
  138. #      define _BSD_SOURCE
  139. #      undef _PNG_SAVE_BSD_SOURCE
  140. #    endif
  141. #  endif /* __linux__ */
  142. #endif /* PNG_SETJMP_SUPPORTED */
  143.  
  144. #ifdef BSD
  145. #include <strings.h>
  146. #else
  147. #include <string.h>
  148. #endif
  149.  
  150. /* Other defines for things like memory and the like can go here.  */
  151. #ifdef PNG_INTERNAL
  152. #include <stdlib.h>
  153.  
  154. /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
  155.  * aren't usually used outside the library (as far as I know), so it is
  156.  * debatable if they should be exported at all.  In the future, when it is
  157.  * possible to have run-time registry of chunk-handling functions, some of
  158.  * these will be made available again.
  159. #define PNG_EXTERN extern
  160.  */
  161. #define PNG_EXTERN
  162.  
  163. /* Other defines specific to compilers can go here.  Try to keep
  164.  * them inside an appropriate ifdef/endif pair for portability.
  165.  */
  166.  
  167. #if !defined(PNG_NO_FLOATING_POINT_SUPPORTED)
  168. #if defined(MACOS)
  169. /* We need to check that <math.h> hasn't already been included earlier
  170.  * as it seems it doesn't agree with <fp.h>, yet we should really use
  171.  * <fp.h> if possible.
  172.  */
  173. #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  174. #include <fp.h>
  175. #endif
  176. #else
  177. #include <math.h>
  178. #endif
  179. #endif
  180.  
  181. /* Codewarrior on NT has linking problems without this. */
  182. #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  183. #define PNG_ALWAYS_EXTERN
  184. #endif
  185.  
  186. /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
  187.  * stdlib.h like it should (I think).  Or perhaps this is a C++
  188.  * "feature"?
  189.  */
  190. #ifdef __TURBOC__
  191. #include <mem.h>
  192. #include "alloc.h"
  193. #endif
  194.  
  195. #ifdef _MSC_VER
  196. #include <malloc.h>
  197. #endif
  198.  
  199. /* This controls how fine the dithering gets.  As this allocates
  200.  * a largish chunk of memory (32K), those who are not as concerned
  201.  * with dithering quality can decrease some or all of these.
  202.  */
  203. #ifndef PNG_DITHER_RED_BITS
  204. #define PNG_DITHER_RED_BITS 5
  205. #endif
  206. #ifndef PNG_DITHER_GREEN_BITS
  207. #define PNG_DITHER_GREEN_BITS 5
  208. #endif
  209. #ifndef PNG_DITHER_BLUE_BITS
  210. #define PNG_DITHER_BLUE_BITS 5
  211. #endif
  212.  
  213. /* This controls how fine the gamma correction becomes when you
  214.  * are only interested in 8 bits anyway.  Increasing this value
  215.  * results in more memory being used, and more pow() functions
  216.  * being called to fill in the gamma tables.  Don't set this value
  217.  * less then 8, and even that may not work (I haven't tested it).
  218.  */
  219.  
  220. #ifndef PNG_MAX_GAMMA_8
  221. #define PNG_MAX_GAMMA_8 11
  222. #endif
  223.  
  224. /* This controls how much a difference in gamma we can tolerate before
  225.  * we actually start doing gamma conversion.
  226.  */
  227. #ifndef PNG_GAMMA_THRESHOLD
  228. #define PNG_GAMMA_THRESHOLD 0.05
  229. #endif
  230.  
  231. #endif /* PNG_INTERNAL */
  232.  
  233. /* The following uses const char * instead of char * for error
  234.  * and warning message functions, so some compilers won't complain.
  235.  * If you do not want to use const, define PNG_NO_CONST here.
  236.  */
  237.  
  238. #ifndef PNG_NO_CONST
  239. #  define PNG_CONST const
  240. #else
  241. #  define PNG_CONST
  242. #endif
  243.  
  244. /* The following defines give you the ability to remove code from the
  245.  * library that you will not be using.  I wish I could figure out how to
  246.  * automate this, but I can't do that without making it seriously hard
  247.  * on the users.  So if you are not using an ability, change the #define
  248.  * to and #undef, and that part of the library will not be compiled.  If
  249.  * your linker can't find a function, you may want to make sure the
  250.  * ability is defined here.  Some of these depend upon some others being
  251.  * defined.  I haven't figured out all the interactions here, so you may
  252.  * have to experiment awhile to get everything to compile.  If you are
  253.  * creating or using a shared library, you probably shouldn't touch this,
  254.  * as it will affect the size of the structures, and this will cause bad
  255.  * things to happen if the library and/or application ever change.
  256.  */
  257.  
  258. /* Any transformations you will not be using can be undef'ed here */
  259.  
  260. /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
  261.    to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
  262.    on the compile line, then pick and choose which ones to define without
  263.    having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
  264.    if you only want to have a png-compliant reader/writer but don't need
  265.    any of the extra transformations.  This saves about 80 kbytes in a
  266.    typical installation of the library. (PNG_NO_* form added in version
  267.    1.0.1c, for consistency)
  268.  */
  269.  
  270.  
  271.  
  272. #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
  273.     !defined(PNG_NO_READ_TRANSFORMS)
  274. #define PNG_READ_TRANSFORMS_SUPPORTED
  275. #endif
  276. #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
  277.     !defined(PNG_NO_WRITE_TRANSFORMS)
  278. #define PNG_WRITE_TRANSFORMS_SUPPORTED
  279. #endif
  280.  
  281. #ifdef PNG_READ_TRANSFORMS_SUPPORTED
  282. #ifndef PNG_NO_READ_EXPAND
  283. #define PNG_READ_EXPAND_SUPPORTED
  284. #endif
  285. #ifndef PNG_NO_READ_SHIFT
  286. #define PNG_READ_SHIFT_SUPPORTED
  287. #endif
  288. #ifndef PNG_NO_READ_PACK
  289. #define PNG_READ_PACK_SUPPORTED
  290. #endif
  291. #ifndef PNG_NO_READ_BGR
  292. #define PNG_READ_BGR_SUPPORTED
  293. #endif
  294. #ifndef PNG_NO_READ_SWAP
  295. #define PNG_READ_SWAP_SUPPORTED
  296. #endif
  297. #ifndef PNG_NO_READ_PACKSWAP
  298. #define PNG_READ_PACKSWAP_SUPPORTED
  299. #endif
  300. #ifndef PNG_NO_READ_INVERT
  301. #define PNG_READ_INVERT_SUPPORTED
  302. #endif
  303. #ifndef PNG_NO_READ_DITHER
  304. #define PNG_READ_DITHER_SUPPORTED
  305. #endif
  306. #ifndef PNG_NO_READ_BACKGROUND
  307. #define PNG_READ_BACKGROUND_SUPPORTED
  308. #endif
  309. #ifndef PNG_NO_READ_16_TO_8
  310. #define PNG_READ_16_TO_8_SUPPORTED
  311. #endif
  312. #ifndef PNG_NO_READ_FILLER
  313. #define PNG_READ_FILLER_SUPPORTED
  314. #endif
  315. #ifndef PNG_NO_READ_GAMMA
  316. #define PNG_READ_GAMMA_SUPPORTED
  317. #endif
  318. #ifndef PNG_NO_READ_GRAY_TO_RGB
  319. #define PNG_READ_GRAY_TO_RGB_SUPPORTED
  320. #endif
  321. #ifndef PNG_NO_READ_SWAP_ALPHA
  322. #define PNG_READ_SWAP_ALPHA_SUPPORTED
  323. #endif
  324. #ifndef PNG_NO_READ_INVERT_ALPHA
  325. #define PNG_READ_INVERT_ALPHA_SUPPORTED
  326. #endif
  327. #ifndef PNG_NO_READ_STRIP_ALPHA
  328. #define PNG_READ_STRIP_ALPHA_SUPPORTED
  329. #endif
  330. #ifndef PNG_NO_READ_USER_TRANSFORM
  331. #define PNG_READ_USER_TRANSFORM_SUPPORTED
  332. #endif
  333. #ifndef PNG_NO_READ_RGB_TO_GRAY
  334. #define PNG_READ_RGB_TO_GRAY_SUPPORTED
  335. #endif
  336. #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
  337.  
  338. #if !defined(PNG_NO_PROGRESSIVE_READ) && \
  339.  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive   */
  340. #define PNG_PROGRESSIVE_READ_SUPPORTED       /* reading.  This is not talking */
  341. #endif                               /* about interlacing capability!  You'll */
  342.               /* still have interlacing unless you change the following line: */
  343. #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
  344.  
  345. #ifndef PNG_NO_READ_COMPOSITED_NODIV
  346. #define PNG_READ_COMPOSITE_NODIV_SUPPORTED    /* well tested on Intel and SGI */
  347. #endif
  348.  
  349. #ifndef PNG_NO_READ_EMPTY_PLTE
  350. #define PNG_READ_EMPTY_PLTE_SUPPORTED  /* useful for MNG applications */
  351. #endif
  352.  
  353. #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
  354. #ifndef PNG_NO_WRITE_SHIFT
  355. #define PNG_WRITE_SHIFT_SUPPORTED
  356. #endif
  357. #ifndef PNG_NO_WRITE_PACK
  358. #define PNG_WRITE_PACK_SUPPORTED
  359. #endif
  360. #ifndef PNG_NO_WRITE_BGR
  361. #define PNG_WRITE_BGR_SUPPORTED
  362. #endif
  363. #ifndef PNG_NO_WRITE_SWAP
  364. #define PNG_WRITE_SWAP_SUPPORTED
  365. #endif
  366. #ifndef PNG_NO_WRITE_PACKSWAP
  367. #define PNG_WRITE_PACKSWAP_SUPPORTED
  368. #endif
  369. #ifndef PNG_NO_WRITE_INVERT
  370. #define PNG_WRITE_INVERT_SUPPORTED
  371. #endif
  372. #ifndef PNG_NO_WRITE_FILLER
  373. #define PNG_WRITE_FILLER_SUPPORTED  /* This is the same as WRITE_STRIP_ALPHA */
  374. #endif
  375. #ifndef PNG_NO_WRITE_SWAP_ALPHA
  376. #define PNG_WRITE_SWAP_ALPHA_SUPPORTED
  377. #endif
  378. #ifndef PNG_NO_WRITE_INVERT_ALPHA
  379. #define PNG_WRITE_INVERT_ALPHA_SUPPORTED
  380. #endif
  381. #ifndef PNG_NO_WRITE_USER_TRANSFORM
  382. #define PNG_WRITE_USER_TRANSFORM_SUPPORTED
  383. #endif
  384. #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
  385.  
  386. #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
  387.                                             encoders, but can cause trouble
  388.                                             if left undefined */
  389.  
  390. #ifndef PNG_NO_WRITE_WEIGHTED_FILTER
  391. #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
  392. #endif
  393.  
  394. #ifndef PNG_NO_WRITE_FLUSH
  395. #define PNG_WRITE_FLUSH_SUPPORTED
  396. #endif
  397.  
  398. #ifndef PNG_NO_WRITE_EMPTY_PLTE
  399. #define PNG_WRITE_EMPTY_PLTE_SUPPORTED  /* useful for MNG applications */
  400. #endif
  401.  
  402. #ifndef PNG_NO_STDIO
  403. #define PNG_TIME_RFC1123_SUPPORTED
  404. #endif
  405.  
  406. /* This adds extra functions in pngget.c for accessing data from the
  407.  * info pointer (added in version 0.99)
  408.  * png_get_image_width()
  409.  * png_get_image_height()
  410.  * png_get_bit_depth()
  411.  * png_get_color_type()
  412.  * png_get_compression_type()
  413.  * png_get_filter_type()
  414.  * png_get_interlace_type()
  415.  * png_get_pixel_aspect_ratio()
  416.  * png_get_pixels_per_meter()
  417.  * png_get_x_offset_pixels()
  418.  * png_get_y_offset_pixels()
  419.  * png_get_x_offset_microns()
  420.  * png_get_y_offset_microns()
  421.  */
  422. #ifndef PNG_NO_EASY_ACCESS
  423. #define PNG_EASY_ACCESS_SUPPORTED
  424. #endif
  425.  
  426. #if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD) && \
  427.   !defined(PNG_NO_ASSEMBLER_CODE)
  428. #define PNG_ASSEMBLER_CODE_SUPPORTED
  429. #endif
  430.  
  431. #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
  432. #define PNG_FLOATING_POINT_SUPPORTED
  433. #endif
  434.  
  435. #ifndef PNG_NO_FIXED_POINT_SUPPORTED
  436. #define PNG_FIXED_POINT_SUPPORTED
  437. #endif
  438.  
  439. /* Do not use global arrays (helps with building DLL's)
  440.  * They are no longer used in libpng itself, since version 1.0.5c,
  441.  * but might be required for some pre-1.0.5c applications.
  442.  */
  443. #ifdef PNG_NO_GLOBAL_ARRAYS
  444. #  define PNG_USE_LOCAL_ARRAYS
  445. #else
  446. #  if defined(__GNUC__) && defined(WIN32)
  447. #    define PNG_NO_GLOBAL_ARRAYS
  448. #    define PNG_USE_LOCAL_ARRAYS
  449. #  else
  450. #    define PNG_USE_GLOBAL_ARRAYS
  451. #  endif
  452. #endif
  453.  
  454. /* These are currently experimental features, define them if you want */
  455.  
  456. /* very little testing */
  457. /*
  458. #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
  459. #define PNG_USER_MEM_SUPPORTED
  460. */
  461.  
  462. /* This is only for PowerPC big-endian and 680x0 systems */
  463. /* some testing */
  464. /*
  465. #define PNG_READ_BIG_ENDIAN_SUPPORTED
  466. */
  467.  
  468. /* These functions are turned off by default, as they will be phased out. */
  469. /*
  470. #define  PNG_USELESS_TESTS_SUPPORTED
  471. #define  PNG_CORRECT_PALETTE_SUPPORTED
  472. */
  473.  
  474. /* Any chunks you are not interested in, you can undef here.  The
  475.  * ones that allocate memory may be expecially important (hIST,
  476.  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
  477.  * a bit smaller.
  478.  */
  479.  
  480. #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  481.     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
  482. #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  483. #endif
  484. #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  485.     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
  486. #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  487. #endif
  488.  
  489. #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  490.  
  491. #ifdef PNG_NO_READ_TEXT
  492. #  define PNG_NO_READ_iTXt
  493. #  define PNG_NO_READ_tEXt
  494. #  define PNG_NO_READ_zTXt
  495. #endif
  496. #ifndef PNG_NO_READ_bKGD
  497. #  define PNG_READ_bKGD_SUPPORTED
  498. #  define PNG_bKGD_SUPPORTED
  499. #endif
  500. #ifndef PNG_NO_READ_cHRM
  501. #  define PNG_READ_cHRM_SUPPORTED
  502. #  define PNG_cHRM_SUPPORTED
  503. #endif
  504. #ifndef PNG_NO_READ_gAMA
  505. #  define PNG_READ_gAMA_SUPPORTED
  506. #  define PNG_gAMA_SUPPORTED
  507. #endif
  508. #ifndef PNG_NO_READ_hIST
  509. #  define PNG_READ_hIST_SUPPORTED
  510. #  define PNG_hIST_SUPPORTED
  511. #endif
  512. #ifndef PNG_NO_READ_iCCP
  513. #  define PNG_READ_iCCP_SUPPORTED
  514. #  define PNG_iCCP_SUPPORTED
  515. #endif
  516. #ifndef PNG_NO_READ_iTXt
  517. #  define PNG_READ_iTXt_SUPPORTED
  518. #  define PNG_iTXt_SUPPORTED
  519. #endif
  520. #ifndef PNG_NO_READ_oFFs
  521. #  define PNG_READ_oFFs_SUPPORTED
  522. #  define PNG_oFFs_SUPPORTED
  523. #endif
  524. #ifndef PNG_NO_READ_pCAL
  525. #  define PNG_READ_pCAL_SUPPORTED
  526. #  define PNG_pCAL_SUPPORTED
  527. #endif
  528. #ifndef PNG_NO_READ_sCAL
  529. #  define PNG_READ_sCAL_SUPPORTED
  530. #  define PNG_sCAL_SUPPORTED
  531. #endif
  532. #ifndef PNG_NO_READ_pHYs
  533. #  define PNG_READ_pHYs_SUPPORTED
  534. #  define PNG_pHYs_SUPPORTED
  535. #endif
  536. #ifndef PNG_NO_READ_sBIT
  537. #  define PNG_READ_sBIT_SUPPORTED
  538. #  define PNG_sBIT_SUPPORTED
  539. #endif
  540. #ifndef PNG_NO_READ_sPLT
  541. #  define PNG_READ_sPLT_SUPPORTED
  542. #  define PNG_sPLT_SUPPORTED
  543. #endif
  544. #ifndef PNG_NO_READ_sRGB
  545. #  define PNG_READ_sRGB_SUPPORTED
  546. #  define PNG_sRGB_SUPPORTED
  547. #endif
  548. #ifndef PNG_NO_READ_tEXt
  549. #  define PNG_READ_tEXt_SUPPORTED
  550. #  define PNG_tEXt_SUPPORTED
  551. #endif
  552. #ifndef PNG_NO_READ_tIME
  553. #  define PNG_READ_tIME_SUPPORTED
  554. #  define PNG_tIME_SUPPORTED
  555. #endif
  556. #ifndef PNG_NO_READ_tRNS
  557. #  define PNG_READ_tRNS_SUPPORTED
  558. #  define PNG_tRNS_SUPPORTED
  559. #endif
  560. #ifndef PNG_NO_READ_zTXt
  561. #  define PNG_READ_zTXt_SUPPORTED
  562. #  define PNG_zTXt_SUPPORTED
  563. #endif
  564. #ifndef PNG_NO_READ_USER_CHUNKS
  565. #  define PNG_READ_USER_CHUNKS_SUPPORTED
  566. #  define PNG_USER_CHUNKS_SUPPORTED
  567. #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
  568. #    undef PNG_NO_READ_UNKNOWN_CHUNKS
  569. #  endif
  570. #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
  571. #    undef PNG_NO_HANDLE_AS_UNKNOWN
  572. #  endif
  573. #endif
  574. #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
  575. #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
  576. #  define PNG_UNKNOWN_CHUNKS_SUPPORTED
  577. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  578. #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  579. #  endif
  580. #endif
  581. #ifndef PNG_NO_READ_OPT_PLTE
  582. #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
  583. #endif                      /* optional PLTE chunk in RGB and RGBA images */
  584. #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
  585.   defined(PNG_READ_zTXt_SUPPORTED)
  586. #  define PNG_READ_TEXT_SUPPORTED
  587. #  define PNG_TEXT_SUPPORTED
  588. #endif
  589. #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
  590.  
  591. #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  592. #ifdef PNG_NO_WRITE_TEXT
  593. #  define PNG_NO_WRITE_iTXt
  594. #  define PNG_NO_WRITE_tEXt
  595. #  define PNG_NO_WRITE_zTXt
  596. #endif
  597. #ifndef PNG_NO_WRITE_bKGD
  598. #  define PNG_WRITE_bKGD_SUPPORTED
  599. #  ifndef PNG_bKGD_SUPPORTED
  600. #    define PNG_bKGD_SUPPORTED
  601. #  endif
  602. #endif
  603. #ifndef PNG_NO_WRITE_cHRM
  604. #  define PNG_WRITE_cHRM_SUPPORTED
  605. #  ifndef PNG_cHRM_SUPPORTED
  606. #    define PNG_cHRM_SUPPORTED
  607. #  endif
  608. #endif
  609. #ifndef PNG_NO_WRITE_gAMA
  610. #  define PNG_WRITE_gAMA_SUPPORTED
  611. #  ifndef PNG_gAMA_SUPPORTED
  612. #    define PNG_gAMA_SUPPORTED
  613. #  endif
  614. #endif
  615. #ifndef PNG_NO_WRITE_hIST
  616. #  define PNG_WRITE_hIST_SUPPORTED
  617. #  ifndef PNG_hIST_SUPPORTED
  618. #    define PNG_hIST_SUPPORTED
  619. #  endif
  620. #endif
  621. #ifndef PNG_NO_WRITE_iCCP
  622. #  define PNG_WRITE_iCCP_SUPPORTED
  623. #  ifndef PNG_iCCP_SUPPORTED
  624. #    define PNG_iCCP_SUPPORTED
  625. #  endif
  626. #endif
  627. #ifndef PNG_NO_WRITE_iTXt
  628. #  define PNG_WRITE_iTXt_SUPPORTED
  629. #  ifndef PNG_iTXt_SUPPORTED
  630. #    define PNG_iTXt_SUPPORTED
  631. #  endif
  632. #endif
  633. #ifndef PNG_NO_WRITE_oFFs
  634. #  define PNG_WRITE_oFFs_SUPPORTED
  635. #  ifndef PNG_oFFs_SUPPORTED
  636. #    define PNG_oFFs_SUPPORTED
  637. #  endif
  638. #endif
  639. #ifndef PNG_NO_WRITE_pCAL
  640. #  define PNG_WRITE_pCAL_SUPPORTED
  641. #  ifndef PNG_pCAL_SUPPORTED
  642. #    define PNG_pCAL_SUPPORTED
  643. #  endif
  644. #endif
  645. #ifndef PNG_NO_WRITE_sCAL
  646. #  define PNG_WRITE_sCAL_SUPPORTED
  647. #  ifndef PNG_sCAL_SUPPORTED
  648. #    define PNG_sCAL_SUPPORTED
  649. #  endif
  650. #endif
  651. #ifndef PNG_NO_WRITE_pHYs
  652. #  define PNG_WRITE_pHYs_SUPPORTED
  653. #  ifndef PNG_pHYs_SUPPORTED
  654. #    define PNG_pHYs_SUPPORTED
  655. #  endif
  656. #endif
  657. #ifndef PNG_NO_WRITE_sBIT
  658. #  define PNG_WRITE_sBIT_SUPPORTED
  659. #  ifndef PNG_sBIT_SUPPORTED
  660. #    define PNG_sBIT_SUPPORTED
  661. #  endif
  662. #endif
  663. #ifndef PNG_NO_WRITE_sPLT
  664. #  define PNG_WRITE_sPLT_SUPPORTED
  665. #  ifndef PNG_sPLT_SUPPORTED
  666. #    define PNG_sPLT_SUPPORTED
  667. #  endif
  668. #endif
  669. #ifndef PNG_NO_WRITE_sRGB
  670. #  define PNG_WRITE_sRGB_SUPPORTED
  671. #  ifndef PNG_sRGB_SUPPORTED
  672. #    define PNG_sRGB_SUPPORTED
  673. #  endif
  674. #endif
  675. #ifndef PNG_NO_WRITE_tEXt
  676. #  define PNG_WRITE_tEXt_SUPPORTED
  677. #  ifndef PNG_tEXt_SUPPORTED
  678. #    define PNG_tEXt_SUPPORTED
  679. #  endif
  680. #endif
  681. #ifndef PNG_NO_WRITE_tIME
  682. #  define PNG_WRITE_tIME_SUPPORTED
  683. #  ifndef PNG_tIME_SUPPORTED
  684. #    define PNG_tIME_SUPPORTED
  685. #  endif
  686. #endif
  687. #ifndef PNG_NO_WRITE_tRNS
  688. #  define PNG_WRITE_tRNS_SUPPORTED
  689. #  ifndef PNG_tRNS_SUPPORTED
  690. #    define PNG_tRNS_SUPPORTED
  691. #  endif
  692. #endif
  693. #ifndef PNG_NO_WRITE_zTXt
  694. #  define PNG_WRITE_zTXt_SUPPORTED
  695. #  ifndef PNG_zTXt_SUPPORTED
  696. #    define PNG_zTXt_SUPPORTED
  697. #  endif
  698. #endif
  699. #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
  700. #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
  701. #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  702. #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  703. #  endif
  704. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  705. #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  706. #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  707. #     endif
  708. #  endif
  709. #endif
  710. #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
  711.   defined(PNG_WRITE_zTXt_SUPPORTED)
  712. #  define PNG_WRITE_TEXT_SUPPORTED
  713. #  ifndef PNG_TEXT_SUPPORTED
  714. #    define PNG_TEXT_SUPPORTED
  715. #  endif
  716. #endif
  717. #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
  718.  
  719. /* Turn this off to disable png_read_png() and
  720.  * png_write_png() and leave the row_pointers member
  721.  * out of the info structure.
  722.  */
  723. #ifndef PNG_NO_INFO_IMAGE
  724. #  define PNG_INFO_IMAGE_SUPPORTED
  725. #endif
  726.  
  727. /* need the time information for reading tIME chunks */
  728. #if defined(PNG_tIME_SUPPORTED)
  729. #  include <time.h>
  730. #endif
  731.  
  732. /* Some typedefs to get us started.  These should be safe on most of the
  733.  * common platforms.  The typedefs should be at least as large as the
  734.  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
  735.  * don't have to be exactly that size.  Some compilers dislike passing
  736.  * unsigned shorts as function parameters, so you may be better off using
  737.  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
  738.  * want to have unsigned int for png_uint_32 instead of unsigned long.
  739.  */
  740.  
  741. typedef unsigned long png_uint_32;
  742. typedef long png_int_32;
  743. typedef unsigned short png_uint_16;
  744. typedef short png_int_16;
  745. typedef unsigned char png_byte;
  746.  
  747. /* This is usually size_t.  It is typedef'ed just in case you need it to
  748.    change (I'm not sure if you will or not, so I thought I'd be safe) */
  749. typedef size_t png_size_t;
  750.  
  751. /* The following is needed for medium model support.  It cannot be in the
  752.  * PNG_INTERNAL section.  Needs modification for other compilers besides
  753.  * MSC.  Model independent support declares all arrays and pointers to be
  754.  * large using the far keyword.  The zlib version used must also support
  755.  * model independent data.  As of version zlib 1.0.4, the necessary changes
  756.  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
  757.  * changes that are needed. (Tim Wegner)
  758.  */
  759.  
  760. /* Separate compiler dependencies (problem here is that zlib.h always
  761.    defines FAR. (SJT) */
  762. #ifdef __BORLANDC__
  763. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  764. #define LDATA 1
  765. #else
  766. #define LDATA 0
  767. #endif
  768.  
  769. #if !defined(__WIN32__) && !defined(__FLAT__)
  770. #define PNG_MAX_MALLOC_64K
  771. #if (LDATA != 1)
  772. #ifndef FAR
  773. #define FAR __far
  774. #endif
  775. #define USE_FAR_KEYWORD
  776. #endif   /* LDATA != 1 */
  777.  
  778. /* Possibly useful for moving data out of default segment.
  779.  * Uncomment it if you want. Could also define FARDATA as
  780.  * const if your compiler supports it. (SJT)
  781. #  define FARDATA FAR
  782.  */
  783. #endif  /* __WIN32__, __FLAT__ */
  784.  
  785. #endif   /* __BORLANDC__ */
  786.  
  787.  
  788. /* Suggest testing for specific compiler first before testing for
  789.  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
  790.  * making reliance oncertain keywords suspect. (SJT)
  791.  */
  792.  
  793. /* MSC Medium model */
  794. #if defined(FAR)
  795. #  if defined(M_I86MM)
  796. #     define USE_FAR_KEYWORD
  797. #     define FARDATA FAR
  798. #     include <dos.h>
  799. #  endif
  800. #endif
  801.  
  802. /* SJT: default case */
  803. #ifndef FAR
  804. #   define FAR
  805. #endif
  806.  
  807. /* At this point FAR is always defined */
  808. #ifndef FARDATA
  809. #define FARDATA
  810. #endif
  811.  
  812. /* Typedef for floating-point numbers that are converted
  813.    to fixed-point with a multiple of 100,000, e.g., int_gamma */
  814. typedef png_int_32 png_fixed_point;
  815.  
  816. /* Add typedefs for pointers */
  817. typedef void            FAR * png_voidp;
  818. typedef png_byte        FAR * png_bytep;
  819. typedef png_uint_32     FAR * png_uint_32p;
  820. typedef png_int_32      FAR * png_int_32p;
  821. typedef png_uint_16     FAR * png_uint_16p;
  822. typedef png_int_16      FAR * png_int_16p;
  823. typedef PNG_CONST char  FAR * png_const_charp;
  824. typedef char            FAR * png_charp;
  825. typedef png_fixed_point FAR * png_fixed_point_p;
  826. #ifdef PNG_FLOATING_POINT_SUPPORTED
  827. typedef double          FAR * png_doublep;
  828. #endif
  829.  
  830. /* Pointers to pointers; i.e. arrays */
  831. typedef png_byte        FAR * FAR * png_bytepp;
  832. typedef png_uint_32     FAR * FAR * png_uint_32pp;
  833. typedef png_int_32      FAR * FAR * png_int_32pp;
  834. typedef png_uint_16     FAR * FAR * png_uint_16pp;
  835. typedef png_int_16      FAR * FAR * png_int_16pp;
  836. typedef PNG_CONST char  FAR * FAR * png_const_charpp;
  837. typedef char            FAR * FAR * png_charpp;
  838. typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
  839. #ifdef PNG_FLOATING_POINT_SUPPORTED
  840. typedef double          FAR * FAR * png_doublepp;
  841. #endif
  842.  
  843. /* Pointers to pointers to pointers; i.e. pointer to array */
  844. typedef char            FAR * FAR * FAR * png_charppp;
  845.  
  846. /* libpng typedefs for types in zlib. If zlib changes
  847.  * or another compression library is used, then change these.
  848.  * Eliminates need to change all the source files.
  849.  */
  850. typedef charf *         png_zcharp;
  851. typedef charf * FAR *   png_zcharpp;
  852. typedef z_stream FAR *  png_zstreamp;
  853.  
  854.  
  855. #ifndef PNG_EXPORT
  856.    /* GRR 20000206:  based on zconf.h and MSVC 5.0 docs */
  857. #  if defined(_MSC_VER) && defined(_DLL)
  858. #    define PNG_EXPORT(type,symbol)        type __declspec(dllexport) symbol
  859. #  endif
  860.  
  861.    /* allow for compilation as a DLL under MS Windows */
  862. #  ifdef __WIN32DLL__    /* Borland? */
  863. #    define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
  864. #  endif
  865.  
  866.    /* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */
  867. #  ifdef ALT_WIN32_DLL
  868. #    define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol
  869. #  endif
  870.  
  871.    /* allow for compilation as a DLL with Borland C++ 5.0 */
  872. #  if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
  873. #    define PNG_EXPORT(type,symbol) type _export symbol
  874. #  endif
  875.  
  876.    /* allow for compilation as shared lib under BeOS */
  877. #  ifdef __BEOSDLL__
  878. #    define PNG_EXPORT(type,symbol) __declspec(export) type symbol
  879. #  endif
  880. #endif
  881.  
  882. #ifndef PNG_EXPORT
  883. #  define PNG_EXPORT(type,symbol) type symbol
  884. #endif
  885.  
  886. #if defined(__MINGW32__) || defined(__CYGWIN32__)
  887. #  define PNG_ATTR_DLLIMP
  888. #endif
  889.  
  890. #ifndef PNG_EXPORT_VAR
  891. #  if defined(_MSC_VER) && defined(_DLL)    /* GRR 20000206 */
  892. #    define PNG_EXPORT_VAR(type) extern type __declspec(dllexport)
  893. #  endif
  894. #  ifdef PNG_DECL_DLLEXP
  895. #    define PNG_EXPORT_VAR(type) extern __declspec(dllexport) type
  896. #  endif
  897. #  ifdef PNG_ATTR_DLLEXP
  898. #    define PNG_EXPORT_VAR(type) extern type __attribute__((dllexport))
  899. #  endif
  900. #  ifdef PNG_DECL_DLLIMP
  901. #    define PNG_EXPORT_VAR(type) extern __declspec(dllimport) type
  902. #  endif
  903. #  ifdef PNG_ATTR_DLLIMP
  904. #    define PNG_EXPORT_VAR(type) extern type __attribute__((dllimport))
  905. #  endif
  906. #endif
  907.  
  908. #ifndef PNG_EXPORT_VAR
  909. #    define PNG_EXPORT_VAR(type) extern type
  910. #endif
  911.  
  912. /* User may want to use these so not in PNG_INTERNAL. Any library functions
  913.  * that are passed far data must be model independent.
  914.  */
  915.  
  916. #ifndef PNG_ABORT
  917. #   define PNG_ABORT() abort()
  918. #endif
  919.  
  920. #ifdef PNG_SETJMP_SUPPORTED
  921. #   define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
  922. #else
  923. #   define png_jmpbuf(png_ptr) \
  924.     (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
  925. #endif
  926.  
  927. #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
  928. /* use this to make far-to-near assignments */
  929. #   define CHECK   1
  930. #   define NOCHECK 0
  931. #   define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
  932. #   define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
  933. #   define png_strcpy _fstrcpy
  934. #   define png_strlen _fstrlen
  935. #   define png_memcmp _fmemcmp      /* SJT: added */
  936. #   define png_memcpy _fmemcpy
  937. #   define png_memset _fmemset
  938. #else /* use the usual functions */
  939. #   define CVT_PTR(ptr)         (ptr)
  940. #   define CVT_PTR_NOCHECK(ptr) (ptr)
  941. #   define png_strcpy strcpy
  942. #   define png_strlen strlen
  943. #   define png_memcmp memcmp     /* SJT: added */
  944. #   define png_memcpy memcpy
  945. #   define png_memset memset
  946. #endif
  947. /* End of memory model independent support */
  948.  
  949. /* Just a little check that someone hasn't tried to define something
  950.  * contradictory.
  951.  */
  952. #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
  953. #undef PNG_ZBUF_SIZE
  954. #define PNG_ZBUF_SIZE 65536
  955. #endif
  956.  
  957. #endif /* PNGCONF_H */
  958.  
  959.